package spring.cloud.tasks.common.util;

import org.springframework.validation.BindingResult;
import spring.cloud.tasks.common.domain.Response;

/**
 * Created by xiongpu on 2019/8/15.
 */
public class ControllerUtil {

    public static Response checkResponse(Response response, BindingResult bindingResult) {
        if (bindingResult.hasErrors()) {
            return response.fail("", bindingResult.getFieldError().getDefaultMessage());
        }
        return response;
    }

}
